﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Restaurant.BusinessEntity;

namespace Restaurant.Repository.Mapping
{
    public class ClienteMap : EntityTypeConfiguration<Cliente>
    {
        public ClienteMap()
        {
            this.HasKey(r => r.Id);

            //propiedades
            this.Property(r => r.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(r => r.Nombre)
                .IsRequired().HasMaxLength(50);

            this.Property(r => r.Dniruc)
            .IsRequired().HasMaxLength(11);

            this.Property(r => r.Direccion)
            .IsOptional().HasMaxLength(50);

            this.Property(r => r.Telefono)
            .IsOptional().HasMaxLength(20);

            this.Property(r => r.TipoCliente)
             .IsRequired().HasMaxLength(50);

            //table
            this.ToTable("Cliente");

            //Relaciones

        }

    }
}
